home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / TextFile / c / ReadToD next >
Text File  |  1995-07-08  |  1KB  |  42 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    TextFile.ReadToD.c
  12.     Author:  Copyright © 1992 Jason Williams
  13.     Version: 1.00 (07 Apr 1992)
  14.     Purpose: Generic textfile-handling routines
  15. */
  16.  
  17.  
  18. #include <stdio.h>
  19.  
  20. #include "DeskLib:Core.h"
  21. #include "DeskLib:TextFile.h"
  22.  
  23.  
  24. extern void TextFile_ReadToDelimiter(FILE *infile, char delimiter,
  25.                                      char *line, int maxlength)
  26. {
  27.   int index = 0;
  28.   char thischar = 0;
  29.  
  30.   TextFile_SkipBlanks(infile);
  31.  
  32.   while (!feof(infile) && index < maxlength - 1)
  33.   {
  34.     thischar = getc(infile);
  35.     if (thischar == delimiter)
  36.       break;
  37.  
  38.     line[index++] = thischar;
  39.   }
  40.   line[index] = '\0';
  41. }
  42.